// +---------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +---------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +---------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +---------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +---------------------------------------------------------------------

import request from '@/libs/request';

/**
 * @description 获取种子列表
 * @param {Object} param params {Object} 传值参数
 */
export function getSeedList(params) {
  return request({
    url: '/seed/index',
    method: 'get',
    params,
  });
}

/**
 * @description 添加种子
 * @param {Object} data {Object} 传值参数
 */
export function addSeed(data) {
  return request({
    url: '/seed/addSeed',
    method: 'post',
    data,
  });
}

/**
 * @description 获取种子属性列表
 * @param {Number} seedId {Number} 种子id
 */
export function getSeedAttrList(seedId) {
  return request({
    url: `/seed/seedAttrList/${seedId}`,
    method: 'get',
  });
}

/**
 * @description 获取基础配置列表
 */
export function getBaseConfig() {
  return request({
    url: '/seed/baseConfig',
    method: 'get',
  });
}

/**
 * @description 添加种子属性
 * @param {Object} data {Object} 传值参数
 */
export function addSeedAttr(data) {
  return request({
    url: '/seed/addSeedAttr',
    method: 'post',
    data,
  });
}

/**
 * @description 删除种子属性
 * @param {Number} id {Number} 属性id
 */
export function deleteSeedAttr(id) {
  return request({
    url: `/seed/delSeedAttr/${id}`,
    method: 'delete',
  });
}

/**
 * @description 修改种子状态
 * @param {Number} id {Number} 种子id
 * @param {Number} status {Number} 状态
 */
export function changeSeedStatus(id, status) {
  return request({
    url: `/seed/status/${id}`,
    method: 'post',
    data: { status },
  });
}

/**
 * @description 删除种子(归档隐藏)
 * @param {Number} id {Number} 种子id
 */
export function deleteSeed(id) {
  return request({
    url: `/seed/delSeed/${id}`,
    method: 'delete',
  });
}

/**
 * @description 袋码查询
 * @param {String} code {String} 袋码
 */
export function searchPackCode(code) {
  return request({
    url: '/seed/searchPack',
    method: 'get',
    params: { code },
  });
}

/**
 * @description 获取经销商列表
 * @param {Object} params {Object} 查询参数
 */
export function getDealerList(params) {
  return request({
    url: '/seed/dealerList',
    method: 'get',
    params,
  });
}

/**
 * @description 添加销售出库订单
 * @param {Object} data {Object} 出库数据
 */
export function addSalesOrder(data) {
  return request({
    url: '/seed/addOrder',
    method: 'post',
    data,
  });
}

/**
 * @description 编辑经销商
 * @param {Object} data {Object} 传值参数，包含id
 */
export function editDealer(data) {
  return request({
    url: '/seed/editDealer',
    method: 'post',
    data,
  });
}

/**
 * @description 获取大码列表
 * @param {Object} params {Object} 查询参数
 */
export function getBigCodeList(params) {
  return request({
    url: '/seed/getBigList',
    method: 'get',
    params,
  });
}

/**
 * @description 生成大码
 * @param {Object} data {Object} 传值参数，包含number和mark
 */
export function createBigCode(data) {
  return request({
    url: '/seed/createBigCode',
    method: 'post',
    data,
  });
}

/**
 * @description 获取大码下载链接
 * @param {Number} id {Number} 大码记录id
 */
export function getBigCodeUrl(id) {
  return request({
    url: `/seed/gitBigCodeUrl/${id}`,
    method: 'get',
  });
}

/**
 * @description 获取作物种类配置
 */
export function getCategoryConfig() {
  return request({
    url: '/seed/categoryConfig',
    method: 'get',
  });
}

/**
 * @description 根据小码获取其他小码列表
 * @param {String} code {String} 小码
 */
export function getOtherCode(code) {
  return request({
    url: '/seed/getOtherCode',
    method: 'get',
    params: { code },
  });
}

/**
 * @description 获取公司列表
 * @param {Object} params {Object} 查询参数
 */
export function getCompanyList(params) {
  return request({
    url: '/seed/getCompanyList',
    method: 'get',
    params,
  });
}

/**
 * @description 添加公司
 * @param {Object} data {Object} 传值参数，包含name
 */
export function addCompany(data) {
  return request({
    url: '/seed/addCompany',
    method: 'post',
    data,
  });
}
